package org;

public class JvmTest {

    public static void main(String[] args) {
        // 1、返回虚拟机试图使用的最大内存
        long maxMemory = Runtime.getRuntime().maxMemory();
        // 2、返回JVM的初始化总内存
        long totalMemory = Runtime.getRuntime().totalMemory();

        // 输出结果
        System.out.println("maxMemory = " + maxMemory + " 字节\t\t" + (maxMemory/(double)1024/1024)+ "MB");
        System.out.println("totalMemory = " + totalMemory + " 字节\t" + (totalMemory/(double)1024/1024)+ "MB");
    }

}
